﻿<%@ Page Language="C#" MasterPageFile="~/Common/Master/FrameMain.master" AutoEventWireup="true" Inherits="HumanResource_Employee_Edit" Title="无标题页" Codebehind="Edit.aspx.cs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        td
        {
            height: 30px;
            padding-left: 20px;
            padding-right: 20px;
        }
        
        .lbl1
        {
            font-weight: bold;
        }
        .lbl2
        {
            letter-spacing: 2px;
        }
    </style>
    <script type="text/javascript">
        $(function ()
        {
            $(":text").addClass("txt");
            initArea();
        }
        ); 


        function initArea()
        {
            var areaCode = '<%=AreaCode %>';

            $.get("/common/arealist.ashx", function (data)
            {
                eval("var areas=" + data + ";");

                //$("#province").get(0).options.add(new Option());
                for (var i = 0; i < areas.length; i++)
                {
                    var id = areas[i].ID + ""; //转成字符串                 
                    if (id.substr(2) == "0000")
                    {
                        var opt = new Option();
                        opt.text = areas[i].Name;
                        opt.value = areas[i].ID;
                        if (areaCode != "")
                        {
                            if (id.substr(0, 2) == areaCode.substr(0, 2))
                            {
                                opt.selected = "selected";
                                setCity(areas, id.substr(0, 2), areaCode);
                            }
                        }
                        $("#province").get(0).options.add(opt);
                    }

                }

                $("#province").change(function ()
                {
                    var code = $(this).val().substr(0, 2);
                    setCity(areas, code);
                });

//                $("#city").change(function ()
//                {
//                    var code = $(this).val().substr(0, 4);
//                    setArea(areas, code);
//                });


            });
        }

        //如果有areaCode，表示有初始化
        function setCity(areas, code, areaCode)
        {
            removeAll($("#city").get(0));
            removeAll($("#area").get(0));
            $("#city").get(0).options.add(new Option());
            for (var i = 0; i < areas.length; i++)
            {
                var id = areas[i].ID + ""; //转成字符串     
                if (id.substr(2) != "0000" & id.substr(4) == "00" && id.substr(0, 2) == code)
                {
                    var opt = new Option();
                    opt.text = areas[i].Name;
                    opt.value = areas[i].ID;
                    if (areaCode != null && areaCode != "")
                    {
                        if (id.substr(0, 4) == areaCode.substr(0, 4))
                        {
                            opt.selected = "selected";
                            //setArea(areas, id.substr(0, 4), areaCode);
                        }
                    }
                    $("#city").get(0).options.add(opt);
                }
            }
        }

        function setArea(areas,code, areaCode)
        {
            removeAll($("#area").get(0));
            $("#area").get(0).options.add(new Option());
            for (var i = 0; i < areas.length; i++)
            {
                var id = areas[i].ID + ""; //转成字符串     
                if (id.substr(4) != "00" && id.substr(0, 4) == code)
                {
                    var opt = new Option();
                    opt.text = areas[i].Name;
                    opt.value = areas[i].ID;
                    if (areaCode == id )
                    {
                        opt.selected = "selected";                        
                    }
                    $("#area").get(0).options.add(opt);
                }
            }
        }

        function removeAll(sel)
        {
            if (sel == null)
                return;
            for (var i = 0; i < sel.options.length; )
            {
                sel.options.remove(0);
            }
        }

        function validate()
        {
            var value = $.trim($("#<%=Name.ClientID %>").val());
            if (value == "")
            {
                alert("请输入员工姓名");
                return false;
            }

            var value = $.trim($("#<%=LoginName.ClientID %>").val());
            if (value == "")
            {
                alert("请输入员工登录名");
                return false;
            }

            return true;
        }

        
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Panel ID="pnlMain" runat="server" Width="100%">
        <div id="nav" class="hr_title" style="">
            <asp:Label ID="Label2" runat="server" Style="font-size: 16px;" Text="个人信息"></asp:Label>
            &nbsp;&nbsp; &nbsp; &nbsp;<asp:Label ID="Label4" runat="server" Text="更改您的地址和联系信息。"></asp:Label>
        </div>
        <div class="blocktitle">
            <asp:Label ID="Label15" runat="server" Text="基本信息"></asp:Label>
        </div>
        <div>
            <table>
                <tr>
                    <td>
                        <asp:Label ID="Label1" runat="server" Text="姓　　名：" CssClass="lbl1"></asp:Label>
                        <asp:TextBox ID="Name" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label22" runat="server" CssClass="lbl1" Text="性　　别："></asp:Label>
                        <asp:DropDownList ID="Gender" runat="server" Width="100px">
                        </asp:DropDownList>
                    </td>
                    <td rowspan="5">
                        <asp:Image ID="imgPhotoUrl" runat="server" Height="150px" Width="108px" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label31" runat="server" CssClass="lbl1" Text="登 录 名："></asp:Label>
                        <asp:TextBox ID="LoginName" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label18" runat="server" CssClass="lbl1" Text="身 份 证："></asp:Label>
                        <asp:TextBox ID="IDNumber" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label26" runat="server" Text="生　　日：" CssClass="lbl1"></asp:Label>
                        <asp:TextBox ID="Birthday" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label24" runat="server" CssClass="lbl1" Text="民　　族："></asp:Label>
                        <asp:TextBox ID="Nation" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label19" runat="server" CssClass="lbl1" Text="工　　号："></asp:Label>
                        <asp:TextBox ID="txtCode" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label33" runat="server" CssClass="lbl1" Text="入职日期："></asp:Label>
                        <asp:TextBox ID="HireDate" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label30" runat="server" CssClass="lbl1" Text="职　　务："></asp:Label>
                        <asp:TextBox ID="JobCode" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label32" runat="server" CssClass="lbl1" Text="专业职称："></asp:Label>
                        <asp:TextBox ID="txtTitle" runat="server"></asp:TextBox>
                    </td>                   
                </tr>
                <tr>
                    <td>
                        
                        <asp:Label ID="Label36" runat="server" CssClass="lbl1" Text="上级领导："></asp:Label>
                        <asp:TextBox ID="LeaderName" runat="server"></asp:TextBox>
                        <asp:HiddenField ID="LeaderID" runat="server" />
                    </td>
                    <td>
                        <asp:Label ID="Label3" runat="server" CssClass="lbl1" Text="部　　门："></asp:Label>
                        <asp:TextBox ID="DeptName" runat="server"></asp:TextBox>
                        <asp:HiddenField ID="DeptID" runat="server" />
                    </td>
                     <td style="text-align: center"> </td>
                </tr>
                <tr>
                    <td><asp:Label ID="Label13" runat="server" CssClass="lbl1" Text="状　　态："></asp:Label>
                    <asp:DropDownList    ID="Status" runat="server" Width="100px">
                        </asp:DropDownList>
                    </td>
                    <td colspan="2">
                        <asp:Label ID="Label14" runat="server" CssClass="lbl1" Text="上传头像："></asp:Label>
                        <asp:FileUpload ID="filPhoto" runat="server" hidefocus="hidefocus" />
                      
                    </td>
                    
                </tr>
            </table>
        </div>
        <div class="blocktitle">
            <asp:Label ID="Label10" runat="server" Text="通讯地址"></asp:Label></div>
        <div>
            <table>
                <tr>
                    <td colspan="3">
                        <asp:Label ID="Label34" runat="server" Text="区　　域：" CssClass="lbl1"></asp:Label>
                        <select id="province">
                            <option></option>
                        </select>
                        <select id="city" name="AreaCode">
                            <option></option>
                        </select>
                       <%-- <select id="area" name="AreaName">
                            <option></option>
                        </select>--%>
                    </td>                    
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Label ID="Label28" runat="server" CssClass="lbl1" Text="详细地址："></asp:Label>
                        <asp:TextBox ID="Address" runat="server" Width="322px"></asp:TextBox>
                    </td>                    
                     <td><asp:Label ID="Label29" runat="server" CssClass="lbl1" Text="邮　　编："></asp:Label>
                        <asp:TextBox ID="Zip" runat="server" Width="99px"></asp:TextBox></td>
                </tr>
            </table>
        </div>
        <div class="blocktitle">
            <asp:Label ID="Label16" runat="server" Text="即时聊天/电话"></asp:Label>
        </div>
        <div>
            <table>
                <tr>
                    <td>
                        <asp:Label ID="Label5" runat="server" Text="手　　机："></asp:Label>
                        <asp:TextBox ID="Mobile" runat="server" CssClass="txt"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label9" runat="server" Text="工作电话："></asp:Label>
                        <asp:TextBox ID="OfficePhone" runat="server" CssClass="txt"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label11" runat="server" Text="家庭电话："></asp:Label>
                        <asp:TextBox ID="HomePhone" runat="server" CssClass="txt"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label6" runat="server" Text="电子邮件："></asp:Label>
                        <asp:TextBox ID="Email" runat="server" CssClass="txt" Width="180px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label8" runat="server" Text="　　&nbsp;&nbsp;QQ："></asp:Label>
                        <asp:TextBox ID="QQ" runat="server" CssClass="txt"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label7" runat="server" Text="　&nbsp;&nbsp;&nbsp;MSN："></asp:Label>
                        <asp:TextBox ID="MSN" runat="server" CssClass="txt" Width="180px"></asp:TextBox>
                    </td>
                </tr>                
            </table>
        </div>
        <div id="toolbar_bottom">
            <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" OnClientClick="return validate()" Text="提  交" />
            <input id="Button1" onclick="history.back();" type="button" value="取  消" /></div>
    </asp:Panel>
</asp:Content>
